import { defHttp } from '/@/utils/http/axios';
// 修改请求头为 multipart/form-data
const headers = {
  'Content-Type': 'multipart/form-data',
};

enum Api {
  list = '/file/directory/list',  // 数据管理-列表查询
  dirDictionary = '/file/directory/getDirDictionary',   // 字典列表
  dirRename = '/file/directory/rename',  // 目录重命名
  dirAdd = '/file/directory/add',         // 新增文件夹
  fileMove = '/file/manage/move',         //移动文件
  dirMove = '/file/directory/move',       // 移动文件夹
  projectDirList = '/file/directory/getProjectDirList',   // 获取目录信息
  uploadImg = '/uav/deviceFile/uploadImg',   // 
  dirDelete = '/file/directory/delete',  // 删除单个目录
  delFile = '/file/manage/delete-file',   // 删除单个文件
  fileDetail = '/file/manage/getFileDetail',  // 获取文件详情(文件预览弹框)
  fileDetailList = '/file/manage/getFileDetailPage',   // 文件详情列表查询(文件预览弹框)
  renameFile = '/file/manage/rename-file',  // 文件重命名(文件预览弹框)
  fileTagAdd = '/file/fileTag/add', // 新增标签(文件预览弹框)
  fileTagDel = '/file/fileTag/delete',  // 删除tag(文件预览弹框)
  searchTag = '/file/fileTag/tagList',  // 标签列表查询(文件预览弹框)
  downloadFile = '/file/manage/download-file'    // 文件下载(文件预览弹框)
}

export const postList = (params) => defHttp.post({ url: Api.list, params });
export const getDirDictionary = (params) => defHttp.get({ url: Api.dirDictionary, params });
export const putDirRename = (params) => defHttp.put({ url: Api.dirRename, params });
export const postAddDirApi = (params) => defHttp.post({ url: Api.dirAdd, params }, { isReturnNativeResponse: true });
export const putFileMove = (params) => defHttp.put({ url: Api.fileMove, params });
export const postDirMove = (params) => defHttp.post({ url: Api.dirMove, params });
export const getProjectDirList = (params) => defHttp.get({ url: Api.projectDirList, params });
export const uploadImg = (params) => defHttp.post({ url: Api.uploadImg, params, headers });
export const deteleDirDelete = (params) => defHttp.delete({ url: Api.dirDelete, params, 
  headers: { 'Content-Type':'application/x-www-form-urlencoded' } }, { isReturnNativeResponse: true } );
export const delSingleFile = (params) => defHttp.delete({ url: Api.delFile, params, 
  headers: { 'Content-Type':'application/x-www-form-urlencoded' } }, { isReturnNativeResponse: true } );  
export const getfileDetail = (params) => defHttp.get({ url: Api.fileDetail, params}, { isReturnNativeResponse: true } );
export const postFileDetailList = (params) => defHttp.post({ url: Api.fileDetailList, params}, { isReturnNativeResponse: true } );
export const putRenameFile = (params) => defHttp.put({ url: Api.renameFile, params}, { isReturnNativeResponse: true } );
export const postFileTagAdd = (params) => defHttp.post({ url: Api.fileTagAdd, params}, { isReturnNativeResponse: true } );
export const deleteFileTagDel = (params) => defHttp.delete({ url: Api.fileTagDel, params}, { isReturnNativeResponse: true } );
export const postSearchTag = (params) => defHttp.post({ url: Api.searchTag, params}, { isReturnNativeResponse: true } );
export const postDownloadFile = (params) => defHttp.post({ url: Api.downloadFile, params, 
  headers: { 'Content-Type':'application/x-www-form-urlencoded' } }, { isReturnNativeResponse: true } );